{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 3.1 一元线性回归"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 3.1.2 一元线性回归的代码实现"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "1.绘制散点图"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAWoAAAD4CAYAAADFAawfAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAOHklEQVR4nO3df2jc933H8ddrkkovaYrKfLSxnM3bP4ItoZERJpshdElWNWtIRegfHqSDjGE2ytZ2Q2XaHwv9K39ojHT7Y0OkGy1tWrpOFiM0UQJtGIXV5Wy5VdpUoz+c1lI6XzaUNOttc5T3/tDJseWT73vpfe/7lvV8gPDp+/1E3xfv3L18+t73fI4IAQDy+oWqAwAAro2iBoDkKGoASI6iBoDkKGoASG64jB964MCBOHz4cBk/GgCuS6dPn34pIuqd9pVS1IcPH1aj0SjjRwPAdcn2C7vt49QHACRHUQNAchQ1ACRHUQNAchQ1ACRX6KoP2x+T9AeSQtKKpIci4n/KDAYAe8Xi8prmlla1vtHSwdGaZqbGNT0x1ref3/UZte0xSX8iaTIibpU0JOl43xIAwB62uLym2YUVrW20FJLWNlqaXVjR4vJa345R9NTHsKSa7WFJN0ha71sCANjD5pZW1bq4ecW21sVNzS2t9u0YXYs6ItYk/ZWkH0l6UdLLEfH0znW2T9hu2G40m82+BQSAzNY3Wj1tfzOKnPp4h6QPSPoVSQcl3Wj7wZ3rImI+IiYjYrJe7/guSAC47hwcrfW0/c0ocurjHkk/jIhmRFyUtCDpN/uWAAD2sJmpcdVGhq7YVhsZ0szUeN+OUeSqjx9JusP2DZJa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RcXckmFeRXJXcx9rH/lNJj3c6flWPyQK5qnpMnpN04Br7+zqvSp5RR8S/Svqvayz5gKTPxJavSxq1fXOCXJWIYh8wPPCZFcw1cO0ZvNr+dqT9tfNV8yrmVSRXJWwfkvR+SY/tsqSSx2SBXFn1dV5Zz1GPSfrxZd+fV4ICaPuN9q+uT9r+9UEf3Lt/wHClM7tGLqmCmbV/XT4r6YKkZyIixbwK5JKquY89Kunjkl7fZX9V969Hde1cUjXzCklP2z5t+0SH/X2dV9ai7vRBBRmeeZzR1vvx3y3pbyUtDvLgvvYHDFc2sy65KplZRGxGxO2SDkk6avvWHUsqmVeBXAOfl+37JF2IiNPXWtZhW6nzKpirqsfksYg4IuleSR+2feeO/X2dV9aiPi/plsu+PyRpvaIsl0TEK9u/usbWR5GN2D4wiGO7+wcMVzKzbrmqnFn7mBuSnpX0vh27Kr2P7Zaronkdk3S/7XOSviDpLtuf3bGminl1zVXV/Ssi1tt/XpB0UtLRHUv6Oq+sRf0vkn6v/crpHZJejogXqw5l+1223b59VFvz+88BHLfIBwwPfGZFclUxM9t126Pt2zVJ90j67o5lVcyra64q5hURsxFxKCIOSzou6SsR8eCOZQOfV5FcFd2/brR90/ZtSe+VtPNKsb7Oq8iH2/ad7c9r69XaA7bPS3pYWy+sKCL+XtKXtfWq6fck/UzSQ0lyfVDSH9l+TVJL0vFov8Rbso4fMCzply7LVsXMiuSqYmY3S/q07SFtPXC/GBFP2P7Dy3JVMa8iuaq6j10lwbyK5KpiXu+UdLL998OwpMcj4qky58VbyAEguaynPgAAbRQ1ACRHUQNAchQ1ACRHUQNAchQ1ACRHUQNAcv8PT/1CPSAq9Y0AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "X = [[1], [2], [4], [5]]\n",
    "Y = [2, 4, 6, 8]\n",
    "plt.scatter(X, Y)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "2.引入Scikit-learn库搭建模型"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "LinearRegression(copy_X=True, fit_intercept=True, n_jobs=None, normalize=False)"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from sklearn.linear_model import LinearRegression\n",
    "regr = LinearRegression()\n",
    "regr.fit(X,Y)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "3.模型预测"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[2.9]\n"
     ]
    }
   ],
   "source": [
    "# 模型预测 - 预测一个数据\n",
    "y = regr.predict([[1.5]])\n",
    "print(y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[2.9 4.3 7.1]\n"
     ]
    }
   ],
   "source": [
    "# 模型预测 - 预测多个数据\n",
    "y = regr.predict([[1.5], [2.5], [4.5]])\n",
    "print(y)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "4.模型可视化"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAWoAAAD4CAYAAADFAawfAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAXZUlEQVR4nO3de3hU9Z3H8fdXiBC5GBWQi4SLSBCwGkxZWqtVUamoS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9Bvxz4vYXgD974pWgKOdKOpc5habz/qFx9xnufpS7D6XphcI/u/u0pM0yvlZB5sr0WiX22cPMejXfBs4Ckq8SS/tzMUgLeSjM7EGargjoY2ZvA9fR9OIK7v4r4EmaXj1dA3wIXBqDmb4A/LuZNQB1wIVhf8MmtNoEDxS3mC3j6xVwrijWbABwr5l1oekHw5/cfZ6Z/RCodPfHaPoB8wczW0PT0eGFIc8UdK5vm9kUoCEx1yUZmOtjYrBWQeaKYq2OBOYmjj26An9096fN7N8gvOeifoVcRCTm4nzqQ0REUFCLiMSeglpEJOYU1CIiMaegFhGJOQW1iEjMKahFRGLu/wDuz28SzHZwZAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(X, Y)\n",
    "plt.plot(X, regr.predict(X))\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "5.线性回归方程构造"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "系数a为:1.4000000000000004\n",
      "截距b为:0.7999999999999989\n"
     ]
    }
   ],
   "source": [
    "print('系数a为:' + str(regr.coef_[0]))\n",
    "print('截距b为:' + str(regr.intercept_))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "那么此时的一元线性回归得到的线性回归方程就可以表示为如下形式：y = 1.4*x + 0.8"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 3.1.3 案例实战：工作年限与收入的线性回归模型"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "1.案例背景\n",
    "\n",
    "通常来说，收入都会随着工作年限的增长而增长，而在不同的行业中收入的增长速度都会有所不同，本小节就是来通过一元线性回归模型来探寻工作年限对收入的影响，也即搭建收入预测模型，同时比较多个行业的收入预测模型来分析各个行业的特点。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "2.读取数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>工龄</th>\n",
       "      <th>薪水</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0.0</td>\n",
       "      <td>10808</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0.1</td>\n",
       "      <td>13611</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0.2</td>\n",
       "      <td>12306</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0.3</td>\n",
       "      <td>12151</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0.3</td>\n",
       "      <td>13057</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    工龄     薪水\n",
       "0  0.0  10808\n",
       "1  0.1  13611\n",
       "2  0.2  12306\n",
       "3  0.3  12151\n",
       "4  0.3  13057"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "df = pd.read_excel('IT行业收入表.xlsx')\n",
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 此时的工龄为自变量，薪水为因变量，通过如下代码进行自变量、因变量选取\n",
    "X = df[['工龄']]\n",
    "Y = df['薪水']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYoAAAEECAYAAAA2xHO4AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAe60lEQVR4nO3de5RlZXnn8e+viyIUkHQ1Q4lDRQQnDKxg07bUcFkgAuHiPT2oIcbLmlFCkmGZlbimx2ZJRhhBmDALx+VSk46YGDGMXLQHJE6jQ6MMsdHqtNiaoVeicrGiyzZ0QbBrtLr6mT/OPl2nT53L3ufsffa5/D5r1bLqPefs8x6B/Zz3fZ/3eRURmJmZNbOq7A6YmVl/c6AwM7OWHCjMzKwlBwozM2vJgcLMzFpyoDAzs5YOK7sDRTj22GPjxBNPLLsbZmYDY8eOHT+JiKlGjw1loDjxxBOZnZ0tuxtmZgND0pPNHvPUk5mZteRAYWZmLTlQmJlZSw4UZmbWkgOFmZm1NJRZT2Zmo2TLzjlu2bqbf5xf4PjJCTZedgob1k/ndn0HCjOzAbZl5xzXfG4XC4tLAMzNL3DN53YB5BYsPPVkZjbAbtm6+2CQqFpYXOKWrbtzew8HCjOzAfaP8wuZ2jvhQGFmNsCOn5zI1N4JBwozswG28bJTmBgfO6RtYnyMjZedktt7eDHbzGyAVResBzLrSdIxwBnAzoj4SVHvY2Y2ahqlwz6y6aLC3q+QqSdJa4AvAGcC2yRNSXpK0kPJz9rkeddL+oakj9a8NlWbmdkoqqbDzs0vECynw27ZOVfYexa1RnE68J6IuBHYCrwTuCMiLkh+dkk6A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8/gIqI/ovA3cDuyPiJz3ttFlKznoy6xFJq4FfA3ZTKWP/iYh4S5IiuxXYEBH/VGIXzRpyoDDrA5LGImKp7H6YNeJAYWZmLTnryczMWnKgMDOzlhwozMysJQcKMzNryYHCzMxa+v+k02iklsJkUwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 通过如下代码可以将此时的散点图绘制出来：\n",
    "from matplotlib import pyplot as plt\n",
    "plt.rcParams['font.sans-serif'] = ['SimHei']  # 用来正常显示中文标签\n",
    "plt.scatter(X,Y)\n",
    "plt.xlabel('工龄')\n",
    "plt.ylabel('薪水')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "3.模型搭建"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "LinearRegression(copy_X=True, fit_intercept=True, n_jobs=None, normalize=False)"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from sklearn.linear_model import LinearRegression\n",
    "regr = LinearRegression()  # 引入模型\n",
    "regr.fit(X,Y)  # 训练模型"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "4.模型可视化"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYoAAAEECAYAAAA2xHO4AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nO3deXiU1fnG8e+TGDWIEtQUJUpBpaiIyFIUQQQq7kuKuy1al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8B7gT6mNlvAu5PXVcCDwfdiVr+BfwQuAr4L957WNIoKLaL68pV2c7M9gTuBy4Jui+1Oc+VwGLg9KD7EzISeMg5Vx50R2pZ7JxbGfpzMZAW060hPYApzrmvgWnAoID7U8PMsvD681rAXaltNPBr59ytwIfAxcl8cr0ZbqcrVxMQ+gl5FjAqdLlUWjCzG8zswtCHeUC6vDEfB1xpZq8BR5jZ1ID7A/BXM+tuZtlAIbAo6A7V8glwQOjPvWl87TY/HAO869LrbEFboFvo3/JIIKl90zmKEDPbA29x6lXgJOCodJryMbPXwjcGpgMzuxy4ne1vLg8752YE2CWgZvF/JrAL8AFwZZr9D502/5ZmdhjwN8CA55xzNwbcpRpmtjvwGN4UcA5wlnOuLPZXpYaZ3Q4UO+eeDrovYWbWB3gcb/rpHeCnzrmNSXv+NPt/KFChN5khwBuhIa+ISIunoBARkZi0RiEiIjEpKEREJCYFhUjAzCxdTmqLRKSgEEmS0NbESO1Z4VPPZrZfqGDhr2o95FEzS5cSKCL1KChEkmeqmb0eKhj3uZl9GDo38QbeCWOAScBW4CozG29mrYBdgWGhg1wiaUe7nkR8EKpA/JVz7s+12vLxyj78Da8ezzTgV0ApsBk4E/idcy4tyo6IhOknGJHUOQxvdNEHr7bYpUBXYD+8U+Tz8WpUiaQVBYVI6nwB/ADvpPHzQEfgz3iVPzsB65xz04LqnEg0CgqR1HHANrzaRcfijSo24JWQ3w1v6kkk7aRN/XmRFsABxwN/xVvAdkAbYE9gAHBecF0TiU5BIZIEZjYSrwLr1lDTvsAWM7ss9PHOwFPAV6E//wBvRP8KMBtY5pxbndJOi8RJu55EUsTM2gA/AZbhlbGf6pw7P7RFdi5Q6JxbE2AXRSJSUIikATPLds5VB90PkUgUFCIiEpN2PYmISEwKChERiUlBISIiMSkoREQkJgWFiIjE9P9sfKGju07z+gAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(X,Y)\n",
    "plt.plot(X, regr.predict(X), color='red')  # color='red'设置为红色\n",
    "plt.xlabel('工龄')\n",
    "plt.ylabel('薪水')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "5.线性回归方程构造"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "系数a为:2497.1513476046866\n",
      "截距b为:10143.131966873787\n"
     ]
    }
   ],
   "source": [
    "print('系数a为:' + str(regr.coef_[0]))\n",
    "print('截距b为:' + str(regr.intercept_))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "所以此时的一元线性回归曲线方程为：y = 2497*x + 10143"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 补充知识点：模型优化 - 一元多次线性回归模型"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "对于一元线性回归模型而言，其实它还有一个进阶版本，叫作一元多次线性回归模型，比较常见的有一元二次线性回归模型，其格式如下：\n",
    "\n",
    "**y = a*x^2 + b*x + c**\n",
    "\n",
    "我们之所以还会研究一元多次线性回归模型，是因为有时真正契合的趋势线可能不是一条直线，而是一条曲线，比如下图根据一元二次线性回归模型形成的曲线更契合散点图背后的趋势。\n",
    "![图片链接](https://uploader.shimo.im/f/KY7rIltpd5AEfgFI.png!thumbnail)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 通过如下代码生成二次项数据：\n",
    "from sklearn.preprocessing import PolynomialFeatures\n",
    "poly_reg = PolynomialFeatures(degree=2)\n",
    "X_ = poly_reg.fit_transform(X)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[1.   0.   0.  ]\n",
      " [1.   0.1  0.01]\n",
      " [1.   0.2  0.04]\n",
      " [1.   0.3  0.09]\n",
      " [1.   0.3  0.09]]\n"
     ]
    }
   ],
   "source": [
    "print(X_[0:5])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "LinearRegression(copy_X=True, fit_intercept=True, n_jobs=None, normalize=False)"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 模型训练\n",
    "regr = LinearRegression()\n",
    "regr.fit(X_, Y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX0AAAD2CAYAAAA6eVf+AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nO3deXzU1b3/8deHECCAEFBESVVAEbwUEI0oBS0oiIjWiHqxdemv2kuta7WXFkXrUpdcsdLWutFq9bqgKIgKKoqAglU0kQpyhUerbEbQsARZIoTk/P74TiCZzPKdzJrJ+/l4zENzMsuZ2H7mzOf7OZ9jzjlERKR5aJHuCYiISOoo6IuINCMK+iIizYiCvohIM6KgLyLSjLRM9wQiOeigg1z37t3TPQ0RkSaltLR0k3OuS6jfZXTQ7969OyUlJemehohIk2Jma8P9TukdEZFmREFfRKQZUdAXEWlGFPRFRJoRBX0RkWYko6t3RESam1lLy5g8dxVfVVTSLT+PCaN6UzSwIGHPr6AvIpIhZi0t48aZy6msqgagrKKSG2cuB0hY4Fd6R0QkQ0yeu2pfwK9VWVXN5LmrEvYaCvoiIhniq4rKmMYbQ0FfRCRDdMvPi2m8MRT0RUQyxIRRvcnLzak3lpebw4RRvRP2GrqQKyKSIWov1qp6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aj12Ab9I5n1rOuXeccx+Y2Sl4q/330z0nADM7FdiJ9wGZKU4CzjKzDwPfcjPmgKTAORp/BdaY2Tnpnk8wMysAujrnStI9F2Az8H0zywcOA9Yn+gWyNehH7eaZDiE6lmYUMxsMdHLOfZDuudQyM8P7oNwKVKV5OgRSX7cAE9M9lyAfASOcc4OAXODMNM+nrkuB/wPuBQaZ2TVpnk+wq4CH0z2JgMV4LRSuBT7Di18Jla1BX908Y2RmnYEHgMvSPZe6nOcqYBnwo3TPBy/YP+Scq0j3RIIsc85tCPx7CZARKc2AgcBU59xG4GlgeJrns4+ZtcCbz8I0T6XWrcAVzrk7gJXAzxL9AtkaDNXNMwaB1esLwI3OuXga3CWUmf3WzC4N/JgPZEKgHQFcZWYLgWPN7G9pnk+tp8xsgJnlAEXAJ+meUB3/BnoG/r0QyJj/jQEnA0tc5mxY6gT0C/x3PBFI+LyycnOWmXXAuzDzNjAaOCmT0ipmtjBw8SgjmNkvgbvZHygeds49n8YpAfsufE8HWgOfAldl0P85M+q/o5l9H3gWMOAV59ykNE9pn8CxqI/jpVlzgfOdc2WRH5UaZnY3UOKcm5nuuQCY2SDg73gpnveBc51zOxL6Ghn0/6GECgSMkcC7ga+VIiLNXtYGfRERaShbc/oiIhKCgr6ISDOioC8i0owo6IuINCMK+iIizcj/B9vUFRBxoYriAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 可视化\n",
    "plt.scatter(X,Y)\n",
    "plt.plot(X, regr.predict(X_), color='red')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[   0.         -743.68080444  400.80398224]\n",
      "13988.159332096882\n"
     ]
    }
   ],
   "source": [
    "# 打印系数和常数项\n",
    "print(regr.coef_)  # 获取系数a, b \n",
    "print(regr.intercept_)  # 获取常数项c"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "此时的系数项中为3个数，第一个0对应之前生成的X_常数项前面的系数，也对应之前说的X_的常数项不会产生影响；-743.68代表的X_一次项前面的系数，也即系数b；400.8代表的X_二次项前面的系数，也即系数a；而13988则代表常数项c，所以该一元二次线性回归方程为：\n",
    "\n",
    "**y = 400.8*x^2 - 743.68*x + 13988**"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
